#ifndef TEAPOT_H
#define TEAPOT_H

#include <GL/glut.h>

#include "Tire.h"
#include "util.h"

class Teapot
{
	public:
	
		enum Direction {LEFT = 0, RIGHT, STRAIGHT};
		enum Acceleration {FORWARD = 0, REVERSE, COAST};
		
		static const GLdouble STEERING_MIN;
		static const GLdouble STEERING_MAX;
		
		static const GLdouble SPEED_MIN;
		static const GLdouble SPEED_MAX;
		
		static const GLdouble STEERING_OFFSET;
		static const GLdouble STEERING_INCREMENT;
		
		static const GLdouble TIRE_FRONT_SPEED;
		static const GLdouble TIRE_REAR_SPEED;
	
		static void setup();
		static void cleanup();
	
		Teapot(GLdouble, GLdouble, GLdouble);
		~Teapot();

		void update();
		void draw() const;
		
		GLdouble getX() const;
		GLdouble getZ() const;
		GLdouble getHeading() const;
		
		void turn(Direction);
		void accelerate(Acceleration);
		
		void setTurnAngle(GLdouble);
		void setColor(GLfloat, GLfloat, GLfloat, GLfloat);
		
	private:
		
		static GLuint baseList;
		
		GLfloat* color;
		
		Tire flTire, frTire, rlTire, rrTire;
		GLdouble turnAngle;
		GLuint alpha;
		
		GLdouble speed;
		GLdouble accelAmount;
		GLdouble brakeAmount;
		GLdouble coastAmount;
		
		Direction dir;
		Acceleration accel;

	protected:

		GLdouble xPos, zPos;
		GLdouble heading;
};

#endif
